/* Design Tokens and CSS Variables */
:root {
  /* Colors */
  --color-primary: #222;
  --color-primary-hover: #444;
  --color-primary-light: #eef2ff;
  --color-secondary: #64748b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #3b82f6;
  
  /* Neutrals */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Text */
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-600);
  --text-tertiary: var(--color-gray-500);
  --text-inverted: var(--color-white);
  
  /* Background */
  --bg-body: var(--color-gray-100);
  --bg-sidebar: var(--color-white);
  --bg-card: var(--color-white);
  --bg-hover: var(--color-gray-100);
  --bg-active: var(--color-primary-light);
  
  /* Border */
  --border-color: var(--color-gray-200);
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-full: 9999px;
  
  /* Spacing */
  --spacing-0: 0;
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;
  --spacing-16: 4rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-md: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  
  /* Font weights */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Layout */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 80px;
  --header-height: 64px;
  --content-max-width: 1200px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Z-index */
  --z-index-sidebar: 100;
  --z-index-header: 90;
  --z-index-dropdown: 200;
  --z-index-modal: 300;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  background-color: var(--bg-body);
  line-height: 1.5;
}

ul {
  list-style: none;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Layout */
.dashboard-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width var(--transition-normal);
  z-index: var(--z-index-sidebar);
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--spacing-4);
  border-bottom: 1px solid var(--border-color);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.logo {
  width: 32px;
  height: 32px;
  background-color: var(--color-primary);
  color: var(--color-white);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.sidebar-nav {
  flex: 1;
  padding: var(--spacing-4) 0;
}

.nav-section-title {
  padding: 0 var(--spacing-4);
  margin-bottom: var(--spacing-2);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: var(--font-weight-medium);
}

.nav-list {
  margin-bottom: var(--spacing-4);
}

.nav-item {
  margin-bottom: var(--spacing-1);
}

.nav-link {
  display: flex;
  align-items: center;
  padding: var(--spacing-2) var(--spacing-4);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.nav-link i {
  margin-right: var(--spacing-3);
  font-size: var(--font-size-lg);
  width: 20px;
  text-align: center;
}

.nav-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active .nav-link {
  background-color: var(--bg-active);
  color: var(--color-primary);
  font-weight: var(--font-weight-medium);
}

.sidebar-footer {
  padding: var(--spacing-4);
  border-top: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  padding: var(--spacing-3) 0;
  margin-top: var(--spacing-4);
}

.avatar {
  width: 32px;
  height: 32px;
  background-color: var(--color-gray-300);
  color: var(--color-gray-700);
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-semibold);
  margin-right: var(--spacing-3);
}

.user-info {
  flex: 1;
}

.user-name {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.user-menu-toggle {
  color: var(--text-tertiary);
  padding: var(--spacing-1);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-4);
  display: flex;
  flex-direction: column;
}

.content-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-6);
}

.header-left {
  display: flex;
  align-items: center;
}

.menu-toggle {
  display: none;
  margin-right: var(--spacing-4);
  color: var(--text-secondary);
  font-size: var(--font-size-xl);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
}

.header-right {
  display: flex;
  gap: var(--spacing-2);
}

.action-button {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.action-button:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-6);
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.metric-card {
  padding: var(--spacing-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-content {
  flex: 1;
}

.card-title {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2);
  font-weight: var(--font-weight-medium);
}

.metric {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-1);
}

.metric-change {
  font-size: var(--font-size-xs);
  display: flex;
  align-items: center;
}

.metric-change.positive {
  color: var(--color-success);
}

.metric-change.negative {
  color: var(--color-danger);
}

.card-icon {
  width: 48px;
  height: 48px;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
}

.chart-card {
  grid-column: span 2;
}

.card-header {
  padding: var(--spacing-4) var(--spacing-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.card-actions {
  display: flex;
  gap: var(--spacing-2);
}

.card-action-button {
  padding: var(--spacing-1) var(--spacing-2);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  border-radius: var(--border-radius-md);
  transition: all var(--transition-fast);
}

.card-action-button:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.card-body {
  padding: var(--spacing-6);
}

.chart-placeholder {
  height: 300px;
  background-color: var(--bg-hover);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
}

.activity-icon {
  width: 36px;
  height: 36px;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.activity-text {
  margin-bottom: var(--spacing-1);
}

.activity-time {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .metric-card {
    grid-column: span 1;
  }
}

@media (max-width: 992px) {
  .chart-card {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
  
  .chart-card {
    grid-column: span 1;
  }
  
  .main-content {
    padding: var(--spacing-3);
  }
}

@media (max-width: 576px) {
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
    height: auto;
  }
  
  .header-right {
    width: 100%;
    justify-content: flex-end;
  }
}